<template>
  <header class="header">
    <h1>小黑记事本</h1>
    <input placeholder="请输入任务" class="new-todo" v-model="text" />
    <!--子传父  1. 子传 -->
    <button class="add" @click="Add">添加任务</button>
  </header>
</template>

<script>
export default {
  // 父传子  2.子收
  props: ['list'],
  data () {
    return {
      text: ''
    }
  },
  methods: {
    Add () {
      this.$emit('Add', this.text)
      this.text = ''
    }
  }
}
</script>

<style lang="scss" scoped></style>
